package com.css.crm.dao;

import java.sql.SQLException;
import java.util.List;

import com.css.crm.exception.SystemException;
import com.css.crm.vo.AbstractObjectPermission;
import com.css.crm.vo.AbstractUser;
import com.css.crm.vo.DiscountCodeVo;
import com.css.crm.vo.DepartmentVo;
import com.css.crm.vo.PlaceVo;
import com.css.crm.vo.StaticReferenceVo;
import com.css.crm.vo.MenuMap;
import com.css.crm.vo.LdapVo;
import com.css.crm.vo.SmUserVo;
import com.css.crm.vo.TitleVo;
import com.css.crm.vo.SystemMenu;

/**
 * Interface for SystemDao to handles calls from SystemService
 */
public interface SystemDao extends BaseDao {

	/**
	 * Get system menu
	 * 
	 * @return List of SystemMenu
	 */
	public List<SystemMenu> getSystemMenu();

	/**
	 * Get application menu
	 * 
	 * @return MenuMap which represent the hierarchy menu structure of
	 *         application
	 */
	public MenuMap getCrmMenuMap();

	/**
	 * Return all available users by ldapId and applId
	 * 
	 * @param ldapId
	 *            ldap id
	 * @param applId
	 *            application id
	 * @return list of available users
	 */
	public List<? extends AbstractUser> getApplAccount(String ldapId, String applId);

	/**
	 * Return all objects permissions by account id and application id
	 * 
	 * @param accountId
	 *            account id
	 * @param applId
	 *            application id
	 * @return list of AbstractObjectPermission
	 */
	public List<? extends AbstractObjectPermission> getAllObjectPermission(String accountId, String applId);

	/**
	 * Return array of String that represents accessible account unit code
	 * 
	 * @param accountId
	 *            account id
	 * @param applId
	 *            application id
	 * @return array of String that represents accessible account unit code,
	 *         null for no suitable unit code
	 */
	public String[] getAccountUnits(String accountId, String applId);

	/**
	 * Return String that represents default unit code
	 * 
	 * @param accountId
	 *            account id
	 * @param applId
	 *            application id
	 * @return String that represents default unit code
	 */
	public String getAccountDefaultUnit(String accountId, String applId) throws SystemException;

	/**
	 * Return String that represents single unit code
	 * 
	 * @param accountId
	 *            account id
	 * @param applId
	 *            application id
	 * @return String that represents single unit code (if and only if user get
	 *         one unit code)
	 */
	public String getAccountSingleUnit(String accountId, String applId) throws SystemException;

	/**
	 * Return original country code by department code of user
	 * 
	 * @param deptCde
	 * @return
	 */
	public String getOrigCtryCode(String deptCde);

	/**
	 * Return data of table IM_PLACE
	 * 
	 * @param PlaceVo
	 *            object
	 * @return List
	 **/
	List<PlaceVo> getPlace(PlaceVo place);

	/**
	 * Return all data of table IM_DEPT
	 * 
	 * @param department
	 *            object
	 * @return List
	 **/
	List<DepartmentVo> getDepartment(DepartmentVo department);

	/**
	 * Return data of table PS_STATC_REF_EXT
	 * 
	 * @param StaticReference
	 *            object
	 * @return List
	 **/
	List<StaticReferenceVo> getStaticReference(StaticReferenceVo staticReference);

	/**
	 * Return all data of table PS_DISC
	 * 
	 * @param DiscountCodeVo
	 *            object
	 * @return List
	 */
	List<DiscountCodeVo> getPsDisc(DiscountCodeVo vo);

	/**
	 * Return all data of table PS_STATC_REF_EXT
	 * 
	 * @param TitleVo
	 *            object
	 * @return List
	 */
	List<TitleVo> getPsStatcRefExt(TitleVo vo);

	/**
	 * Return all ldap user Get all data of table SM_LDAP
	 * 
	 * @param LdapVo
	 *            object
	 * @return List
	 */
	List<LdapVo> getLdap(LdapVo ldap);

	/**
	 * Return all data of table SM_USER
	 * 
	 * @param SmUserVo
	 *            object
	 * @return List
	 */
	List<SmUserVo> getSmUser(SmUserVo vo);

	/**
	 * Return sm user id by ldap id
	 * 
	 * @param ldapUserId
	 * @param userUnitCde
	 * @return
	 * @throws SQLException
	 */
	public String getSmUserId(String ldapId, String userUnitCde) throws SQLException;
}
